//
//  VerifyTextFieldView.m
//  JunZeWristband
//
//  Created by Kendama on 2017/8/17.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "VerifyTextFieldView.h"

@implementation VerifyTextFieldView

- (instancetype)init
{
    self = [super init];
    if (self)
    {
        [self masLayoutSubviews];
        
    }
    return self;
}


- (UITextField *)verifyTextField
{
    if(!_verifyTextField)
    {
        UIView *superView = self;
        _verifyTextField = [[UITextField alloc]init];
        _verifyTextField.font = [UIFont systemFontOfSize:15];
//        _verifyTextField.secureTextEntry = YES;
        [superView addSubview:_verifyTextField];
    }
    return _verifyTextField;
}

- (UIImageView *)iconImageView
{
    if(!_iconImageView)
    {
        UIView *superView = self;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
    }
    return _iconImageView;
}

- (UIButton *)verifyButton
{
    if(!_verifyButton)
    {
        UIView *superView = self;
        _verifyButton = [[UIButton alloc]init];
        [superView addSubview:_verifyButton];
        [_verifyButton setTitle:MyNSLocalizedString(@"获取验证码") forState:UIControlStateNormal];
        [_verifyButton setTitleColor:[UIColor colorWithHexString:@"F06161"] forState:UIControlStateNormal];
        [_verifyButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
        [_verifyButton sizeToFit];
    }
    return _verifyButton;
}


- (void)masLayoutSubviews{
    __weak UIView *superView = self;
    
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.equalTo(superView).with.offset(px1080Width(40));
        make.width.height.mas_equalTo(px1080Width(80));
    }];
    
    [self.verifyTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.iconImageView.mas_right).with.offset(px1080Width(35));
        make.centerY.equalTo(self.iconImageView);
        make.height.mas_equalTo(px1920Height(70));
        make.right.mas_equalTo(self.verifyButton.mas_left);
    }];
    
    [self.verifyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.right.equalTo(superView).with.offset(px1080Width(-40));
        make.width.mas_equalTo(px1080Width(300));
    }];
}

@end
